package com.ruoyi.wechat.api;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wechat.domain.Evaluate;
import com.ruoyi.wechat.service.IEvaluateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/wechat/evaluate")
public class WxEvaluateController extends BaseController {

    @Autowired
    private IEvaluateService evaluateService;

    /**
     * 查询营地评价列表
     */
    @GetMapping("/list")
    public AjaxResult list()
    {
        Evaluate evaluate = new Evaluate();
        List<Evaluate> list = evaluateService.selectEvaluateList(evaluate);
        return success(list);
    }

    /**
     * 获取营地评价详细信息
     */
    @GetMapping(value = "/{evaluateId}")
    public AjaxResult getInfo(@PathVariable("evaluateId") String evaluateId)
    {
        return success(evaluateService.selectEvaluateByEvaluateId(evaluateId));
    }

    /**
     * 新增营地评价
     */
    @PostMapping
    public AjaxResult add(@RequestBody Evaluate evaluate)
    {
        System.out.println(evaluate);
        return toAjax(evaluateService.insertEvaluate(evaluate));
    }

    /**
     * 删除营地评价
     */
    @DeleteMapping("/{evaluateId}")
    public AjaxResult remove(@PathVariable String evaluateId)
    {
        return toAjax(evaluateService.deleteEvaluateByEvaluateId(evaluateId));
    }
}
